.class public Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;
.super Ljava/lang/Object;
.source "FlowController.java"

# interfaces
.implements Llt/noframe/gpsfarmguide/showcase/core/StateChangeObserver$OnStateChangedListener;


# instance fields
.field current:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

.field mIterator:Ljava/util/Iterator;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Iterator<",
            "Llt/noframe/gpsfarmguide/showcase/core/ModelCase;",
            ">;"
        }
    .end annotation
.end field

.field next:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

.field userFlow:Llt/noframe/gpsfarmguide/showcase/core/flow/UserCaseFlow;


# direct methods
.method public constructor <init>()V
    .locals 1

    .line 30
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const/4 v0, 0x0

    .line 24
    iput-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->userFlow:Llt/noframe/gpsfarmguide/showcase/core/flow/UserCaseFlow;

    .line 26
    iput-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->current:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    .line 27
    iput-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->next:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    return-void
.end method


# virtual methods
.method public conditionWasMet(Landroid/app/Activity;)V
    .locals 2

    .line 123
    iget-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->next:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    if-eqz v0, :cond_0

    .line 124
    iput-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->current:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    .line 125
    iget-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->current:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;->getCondition()Ljava/lang/String;

    move-result-object v0

    const-string v1, "CURRENT"

    invoke-static {v1, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 126
    iget-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->current:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    invoke-virtual {p0, v0, p1}, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->showCase(Llt/noframe/gpsfarmguide/showcase/core/ModelCase;Landroid/app/Activity;)V

    const/4 p1, 0x0

    .line 127
    iput-object p1, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->next:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    .line 128
    iget-object p1, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->current:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;->getCondition()Ljava/lang/String;

    move-result-object p1

    const-string v0, "CURRENT_VALD"

    invoke-static {v0, p1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 131
    :cond_0
    iget-object p1, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->mIterator:Ljava/util/Iterator;

    invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z

    move-result p1

    if-eqz p1, :cond_1

    .line 132
    iget-object p1, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->mIterator:Ljava/util/Iterator;

    invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    iput-object p1, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->next:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    .line 133
    iget-object p1, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->next:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;->getCondition()Ljava/lang/String;

    move-result-object p1

    const-string v0, "NEXT"

    invoke-static {v0, p1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    :cond_1
    return-void
.end method

.method public onStateChanged(Ljava/lang/String;Landroid/app/Activity;)V
    .locals 1

    .line 141
    iget-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->next:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    if-eqz v0, :cond_0

    .line 142
    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;->getCondition()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p1

    if-eqz p1, :cond_0

    .line 144
    invoke-virtual {p0, p2}, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->conditionWasMet(Landroid/app/Activity;)V

    :cond_0
    return-void
.end method

.method public reset()V
    .locals 1

    .line 36
    iget-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->userFlow:Llt/noframe/gpsfarmguide/showcase/core/flow/UserCaseFlow;

    invoke-virtual {v0}, Ljava/util/LinkedList;->iterator()Ljava/util/Iterator;

    move-result-object v0

    iput-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->mIterator:Ljava/util/Iterator;

    return-void
.end method

.method public setUserFlow(Llt/noframe/gpsfarmguide/showcase/core/flow/UserCaseFlow;)V
    .locals 0

    .line 32
    iput-object p1, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->userFlow:Llt/noframe/gpsfarmguide/showcase/core/flow/UserCaseFlow;

    return-void
.end method

.method public showCase(Llt/noframe/gpsfarmguide/showcase/core/ModelCase;Landroid/app/Activity;)V
    .locals 4

    .line 73
    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;->getTarget()I

    move-result v0

    if-eqz v0, :cond_0

    .line 74
    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;->getTarget()I

    move-result v0

    invoke-virtual {p2, v0}, Landroid/app/Activity;->findViewById(I)Landroid/view/View;

    move-result-object v0

    goto :goto_0

    .line 76
    :cond_0
    new-instance v0, Landroid/view/View;

    invoke-direct {v0, p2}, Landroid/view/View;-><init>(Landroid/content/Context;)V

    .line 77
    new-instance v1, Landroid/widget/FrameLayout$LayoutParams;

    const/4 v2, 0x0

    invoke-direct {v1, v2, v2}, Landroid/widget/FrameLayout$LayoutParams;-><init>(II)V

    const/16 v2, 0x64

    const/16 v3, -0x64

    .line 78
    invoke-virtual {v1, v3, v3, v2, v2}, Landroid/widget/FrameLayout$LayoutParams;->setMargins(IIII)V

    .line 79
    invoke-virtual {v0, v1}, Landroid/view/View;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    :goto_0
    if-eqz v0, :cond_3

    .line 88
    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;->getShapeType()I

    move-result v1

    const/4 v2, 0x1

    if-eq v1, v2, :cond_2

    const/4 v2, 0x2

    if-ne v1, v2, :cond_1

    .line 95
    new-instance v1, Luk/co/deanwild/materialshowcaseview/RectangleShape;

    new-instance v2, Luk/co/deanwild/materialshowcaseview/ViewTarget;

    invoke-direct {v2, v0}, Luk/co/deanwild/materialshowcaseview/ViewTarget;-><init>(Landroid/view/View;)V

    invoke-virtual {v2}, Luk/co/deanwild/materialshowcaseview/ViewTarget;->getBounds()Landroid/graphics/Rect;

    move-result-object v2

    invoke-direct {v1, v2}, Luk/co/deanwild/materialshowcaseview/RectangleShape;-><init>(Landroid/graphics/Rect;)V

    goto :goto_1

    .line 98
    :cond_1
    new-instance p1, Ljava/lang/IllegalArgumentException;

    const-string p2, "Show case shape type is unknown (this should be either ModelCase.SHAPE_CIRCLE or ModelCase.SHAPE_RECTANGLE)"

    invoke-direct {p1, p2}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw p1

    .line 91
    :cond_2
    new-instance v1, Luk/co/deanwild/materialshowcaseview/CircleShape;

    new-instance v2, Luk/co/deanwild/materialshowcaseview/ViewTarget;

    invoke-direct {v2, v0}, Luk/co/deanwild/materialshowcaseview/ViewTarget;-><init>(Landroid/view/View;)V

    invoke-virtual {v2}, Luk/co/deanwild/materialshowcaseview/ViewTarget;->getBounds()Landroid/graphics/Rect;

    move-result-object v2

    invoke-direct {v1, v2}, Luk/co/deanwild/materialshowcaseview/CircleShape;-><init>(Landroid/graphics/Rect;)V

    .line 103
    :goto_1
    new-instance v2, Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;

    invoke-direct {v2, p2}, Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;-><init>(Landroid/app/Activity;)V

    .line 104
    invoke-virtual {v2, v0}, Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;->setTarget(Landroid/view/View;)Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;

    const v0, 0x7f110153

    .line 105
    invoke-virtual {p2, v0}, Landroid/app/Activity;->getString(I)Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/String;->toUpperCase()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v2, v0}, Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;->setDismissText(Ljava/lang/CharSequence;)Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;

    .line 106
    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;->getContentText()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v2, v0}, Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;->setContentText(Ljava/lang/CharSequence;)Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;

    .line 107
    invoke-virtual {v2, v1}, Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;->setShape(Luk/co/deanwild/materialshowcaseview/Shape;)Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;

    const v0, 0x7f080072

    .line 108
    invoke-virtual {v2, v0}, Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;->setDismissTextBackground(I)Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;

    .line 109
    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;->getDelay()I

    move-result v0

    invoke-virtual {v2, v0}, Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;->setDelay(I)Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;

    .line 110
    invoke-virtual {p2}, Landroid/app/Activity;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    const v1, 0x7f060153

    invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getColor(I)I

    move-result v0

    invoke-virtual {v2, v0}, Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;->setMaskColour(I)Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;

    .line 111
    invoke-virtual {p1, p2}, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;->getDrawable(Landroid/content/Context;)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    invoke-virtual {v2, v0}, Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;->setIllustration(Landroid/graphics/drawable/Drawable;)Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;

    .line 112
    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;->isDispachClick()Z

    move-result p1

    invoke-virtual {v2, p1}, Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;->setPerformViewClickOnTouch(Z)Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;

    .line 113
    invoke-virtual {v2}, Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView$Builder;->build()Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView;

    move-result-object p1

    .line 114
    invoke-virtual {p1, p2}, Luk/co/deanwild/materialshowcaseview/MaterialShowcaseView;->show(Landroid/app/Activity;)Z

    :cond_3
    return-void
.end method

.method public start(Landroid/app/Activity;)V
    .locals 1

    .line 53
    iget-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->mIterator:Ljava/util/Iterator;

    if-eqz v0, :cond_0

    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-nez v0, :cond_1

    .line 54
    :cond_0
    invoke-virtual {p0}, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->reset()V

    .line 56
    :cond_1
    iget-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->mIterator:Ljava/util/Iterator;

    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_2

    .line 57
    iget-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->mIterator:Ljava/util/Iterator;

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    iput-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->current:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    .line 58
    iget-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->current:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    invoke-virtual {p0, v0, p1}, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->showCase(Llt/noframe/gpsfarmguide/showcase/core/ModelCase;Landroid/app/Activity;)V

    .line 60
    iget-object p1, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->current:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;->getCondition()Ljava/lang/String;

    move-result-object p1

    const-string v0, "CURRENT"

    invoke-static {v0, p1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 62
    iget-object p1, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->mIterator:Ljava/util/Iterator;

    invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z

    move-result p1

    if-eqz p1, :cond_2

    .line 63
    iget-object p1, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->mIterator:Ljava/util/Iterator;

    invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    iput-object p1, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->next:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    .line 64
    iget-object p1, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->next:Llt/noframe/gpsfarmguide/showcase/core/ModelCase;

    invoke-virtual {p1}, Llt/noframe/gpsfarmguide/showcase/core/ModelCase;->getCondition()Ljava/lang/String;

    move-result-object p1

    const-string v0, "NEXT"

    invoke-static {v0, p1}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    :cond_2
    return-void
.end method

.method public startFlowIfNotShownBefore(Landroid/app/Activity;Llt/noframe/gpsfarmguide/showcase/core/flow/UserCaseFlow;)V
    .locals 2

    const/4 v0, 0x0

    .line 40
    iput-object v0, p0, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->mIterator:Ljava/util/Iterator;

    .line 41
    new-instance v0, Llt/noframe/gpsfarmguide/showcase/core/PrefsManager;

    iget-object v1, p2, Llt/noframe/gpsfarmguide/showcase/core/flow/UserCaseFlow;->mId:Ljava/lang/String;

    invoke-direct {v0, p1, v1}, Llt/noframe/gpsfarmguide/showcase/core/PrefsManager;-><init>(Landroid/content/Context;Ljava/lang/String;)V

    .line 42
    invoke-virtual {v0}, Llt/noframe/gpsfarmguide/showcase/core/PrefsManager;->hasFired()Z

    move-result v0

    if-eqz v0, :cond_0

    return-void

    .line 45
    :cond_0
    invoke-virtual {p0, p2}, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->setUserFlow(Llt/noframe/gpsfarmguide/showcase/core/flow/UserCaseFlow;)V

    .line 46
    invoke-virtual {p0, p1}, Llt/noframe/gpsfarmguide/showcase/core/flow/FlowController;->start(Landroid/app/Activity;)V

    return-void
.end method
